﻿using System;
using System.Runtime.Serialization;

namespace SimpleLibraryClasses
{
    [Serializable()]
    public class Loan
    {
        public Loan(Item loanItem, Member borrower, DateTime dueDate)
            : this(loanItem, borrower, dueDate, DateTime.Today)
        {
        }
        
        public Loan(Item loanItem, Member borrower, DateTime dueDate, DateTime loanDate)
        {
            this.LoanItem = loanItem;
            this.LoanDate = loanDate;
            this.Borrower = borrower;
            this.DueDate = dueDate;
        }

        /// <summary>
        /// The item on loan
        /// </summary>
        public Item LoanItem { get; private set; }

        /// <summary>
        /// The date this item was put on loan
        /// </summary>
        public DateTime LoanDate { get; private set; }

        /// <summary>
        /// The date this item is due for return
        /// </summary>
        public DateTime DueDate { get; private set; }

        /// <summary>
        /// The member with the item on loan
        /// </summary>
        public Member Borrower { get; private set; }
    }
}
